home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: String Encryption
- Date: 25 Feb 1996 13:21:57 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4gqjtlINNb75@keats.ugrad.cs.ubc.ca>
- References: <1996Feb21.101532.15110@es.dupont.com> <1996Feb21.174407.20730@newshost.micro.ti.com> <4ghq1u$sed@hpbblb.bbn.hp.com>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <4ghq1u$sed@hpbblb.bbn.hp.com>, Matthias Dittrich <matti> wrote:
- >brett@racerx.micro.ti.com (Brett L. Huber) wrote:
- >>Malcolm Smart (MALCOLM.SMART@CONOCO.DUPONT.COM) wrote:
- >>> Has anybody out there got any small routines that I can apply to strings
- >>> which will effectively encrypt them (and decrypt!). It's not a matter of
- >>> state security so it doesn't have to be that secure, just make it
- >>> unreadable.
- >>
- >>It really depends on what level of "unreadability" you want. Who are
- >>you protecting the data from? If you aren't protecting a secret, try
- >>"rot13," which translates A->N, B->O, ... Z->M.
- >>
- >>For an introduction to cryptographic techniques, try the sci.crypt FAQ:
- >>http://www.cis.ohio-state.edu/hypertext/faq/bngusenet/sci/crypt/top.html
- >>
- >> ...
- >You also can use the crypt() function (see man 3 crypt).
-
- This function is technically a one-way hash, not an encryption, which is what
- is called for in the above request.
-
- I think that what the poster wants could be satsified by a translation table
- which matches each printable character to a unique printable character. Such a
- one-to-one and onto mapping is naturally invertible. Rot13 is just one such
- possiblity, though I don't know how it deals with digits and other symbols.
-
- By the way, this kind of translation can be done by the UNIX utility "tr". If
- you have that available, why bother writing a C program? For example, to
- do ROT13 on upper and lower-case letters, you pipe through:
-
- tr [A-Za-z] [N-ZA-Mn-za-m]
-
- The first argument specifies the table of source characters, in a compact form
- resembling regex character classes. The second argument specifies the
- destination table.
-
- In this case, the same command encrypts and decrypts, since Rot13 is
- its own inverse.
- --
-
-